<template>
  <div>
    <el-form :inline="true" :model="customerInfo" label-width="120px">
      <el-row type="flex" align="middle">
        <el-col :span="12">客户信息</el-col>
      </el-row>
      <el-divider content-position="center"></el-divider>
      <el-row>
        <el-col :span="6">
          <el-form-item label="客户类型:">
            <div>{{ customerInfo.clientType }}</div>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="客户名称:">
            <div>{{ customerInfo.clientName }}</div>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="手机号:">
            <div>{{ customerInfo.phone }}</div>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="性别:">
            <div>{{ customerInfo.genderCst }}</div>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="6">
          <el-form-item label="驾驶证号:">
            <div>{{ customerInfo.jszNum }}</div>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="驾驶证到期日期:">
            <div>{{ customerInfo.jszExpireTime }}</div>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="生日:">
            <div>{{ customerInfo.birthday }}</div>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="会员等级:">
            <div>{{ customerInfo.memberLevelDictValue }}</div>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="6">
          <el-form-item label="客户来源:">
            <div>{{ customerInfo.clientSource }}</div>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="地址:">
            <div>{{ customerInfo.address }}</div>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="备注:">
            <div>{{ customerInfo.remark }}</div>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="客户喜好:">
            <div>{{ customerInfo.clientLike }}</div>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>

    <el-form :inline="true" :model="fromdata" label-width="110px" v-if="showRepairman">
      <el-divider content-position="center"></el-divider>
      <el-row type="flex" align="middle">
        <el-col :span="12">送修人信息</el-col>
      </el-row>
      <el-divider content-position="center"></el-divider>
      <el-row>
        <el-col :span="6">
          <el-form-item label="送修人:">
            <div>
              {{ fromdata.giveType ? "他人" : "车主" }}
            </div>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="6">
          <el-form-item label="送修人名称:">
            <div>{{ fromdata.sendRepairName|| customerInfo.clientName}}</div>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="手机号:">
            <div>{{ fromdata.sendRepairPhone|| customerInfo.phone}}</div>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>

<script>
import { getClientById } from "@/api/after-sale/client/client";

export default {
  components: {},
  props: {
    fromdata: {
      type: Object,
      default: () => ({}),
    },
    showRepairman: {
      type: Boolean,
      default: true,
    },
  },
  data() {
    return {
      customerInfo: {},
    };
  },
  async created() {
    const { data } = await getClientById(this.fromdata.clientId);
    this.customerInfo = data;
  },
  methods: {
    changeType(item) {
      this.selectedTypeText = item.label;
    },
  },
  mounted() {},
};
</script>

<style lang="scss" scoped>
.el-table .delete-row {
  background: #f5f7fa;
  color: #ccc !important;
}
.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.avatar-uploader .el-upload:hover {
  border-color: #409eff;
}
.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 178px;
  height: 178px;
  line-height: 178px;
  text-align: center;
}
.avatar {
  width: 80px;
  height: 80px;
  display: block;
}
</style>
